#include "ThreadPool.hpp"

using namespace MyThreadPoolMudule;

void DownLoad(){
    LOG(INFO) << "我是一个下载任务";
}
void Put(){
    LOG(INFO) << "我是一个Put任务";
}
void Http(){
    LOG(INFO) << "我是一个Http任务";
}
using func_t = std::function<void()>;

int main(){
    // ENABLEFILESTRATEGY();
    srand(time(nullptr));
    vector<func_t> tasks;
    tasks.emplace_back(DownLoad);    
    tasks.emplace_back(Put);    
    tasks.emplace_back(Put);    
    int cnt = 10;
    while(cnt--){
        int num = rand() % 3;
        LOG(DEBUG) << "发布一个" << num << "号人物";
        ThreadPool<func_t>::GetInstance()->Enque(tasks[num]);
        sleep(1);
    }
    ThreadPool<func_t>::GetInstance()->Stop();
    return 0;
}